package com.tanhua.server.service;

import com.tanhua.common.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;


@Service
public class UserService {

    @Autowired
    private RestTemplate restTemplate;

    //解析token
    public User queryToekn(String token) {

        String url = "http://localhost:18080/user/" + token;

        //发送url请求userController下的queryToken
        User user = restTemplate.getForObject(url, User.class);//通过restTemplate发送get请求 获取对应的对象

        return user;
    }
}
